//package git.jas0nch.boottest.config;
//
//import org.springframework.util.StringUtils;
//import org.springframework.web.servlet.HandlerInterceptor;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
///**
// * projectName : boottest
// * className: LoginHandlerIntercepter
// * description: TODO 类描述
// *
// * @author : git.jas0nch
// * date: 2022-02-17
// */
//public class LoginHandlerIntercepter implements HandlerInterceptor {
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        System.out.println("the preHandle is working here");
//        Object loginUser = request.getSession().getAttribute("loginUser");
//        if (StringUtils.isEmpty(loginUser)){
//            request.setAttribute("msg","not the loginUser,not allowed to view this website");
//            request.getRequestDispatcher("/index.html").forward(request,response);
//            return false;
//        }else{
//            return true;
//        }
//    }
//
//    @Override
//    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
//        System.out.println("post handle here");
//    }
//
//    @Override
//    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
//        System.out.println("after completion here");
//    }
//}
